/*Testing supplyCount function */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set TEST_OUTPUT to 0 to remove printfs from output
#define TEST_OUTPUT 1

int main() {
	int i;
	int seed = 100;
	int numPlayer = 2;
	int supply;
	//From the example
	int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
	struct gameState G;
	//Taken from the example testUpdateCoins.c, but still quite necessary.
	memset(&G, 23, sizeof(struct gameState));   			// clear the game state
    initializeGame(numPlayer, k, seed, &G); 			// initialize a new game
	
	//This seems straight forward, but it's a good on to test regardless.  This simply returns a supply card state.  I'll iterate through all the supply cards of a new game and check them against a 'fresh' game.  Then we'll start manipulating levels and ensure the changes are picked up.
	for (i = 0; i < (treasure_map +1); ++i)
	{
		supply = supplyCount(i, &G);
		assert (supply == G.supplyCount[i]);
		
		//Make a change to ensure it's tracking.
		
		if (supply > 0) G.supplyCount[i] = 0;
		supply = supplyCount(i, &G);
		assert (supply == G.supplyCount[i]);
	}
	
	//I thought that might be more tricky, I almost feel ashamed... I'll only do one of these.
	printf("Unittest2: All Tests Passed!\n");

	return 0;
}